//商品操作记录.js

function search() {
	var productId = $("#pid").val();
	var startDate = $('#startDate').val();
	var endDate = $('#endDate').val();
	if (productId != '' && isNaN(productId)) {
		layer.alert("输入的商品编号有误，请重新输入！");
		return;
	}
	if ((startDate.length != 0 && startDate != '')
			&& (endDate.length != 0 && endDate != '')) {
		var startTime1 = startDate.slice(0, 4) + startDate.slice(5, 7)
				+ startDate.slice(8, 10);
		var endTime1 = endDate.slice(0, 4) + endDate.slice(5, 7)
				+ endDate.slice(8, 10);
		var timeValue1 = endTime1 - startTime1;
		if (timeValue1 < 0) {
			layer.alert("结束时间必须大于或等于开始时间!");
			return;
		}
	}
	document.getElementsByName("userName")[0].value = document
			.getElementsByName("userName")[0].value.trim();
	document.getElementsByName("pid")[0].value = document
			.getElementsByName("pid")[0].value.trim();
	document.getElementsByName("pName")[0].value = document
	        .getElementsByName("pName")[0].value.trim();
	document.getElementById('startDate').value = document
			.getElementById('startDate').value.trim();
	document.getElementById('endDate').value = document
			.getElementById('endDate').value.trim();
    $("#page").val("1");
    $("#query_productLog_list_form").submit();
}
function toIsEmpty() {
	$("#pid").val("");
	$("#pName").val("");
	$("#userName").val("");
	document.getElementsByName("pType")[0].value = "";
	document.getElementsByName("custName")[0].value = "";
	document.getElementsByName("beginDate")[0].value = "";
	document.getElementsByName("endDate")[0].value = "";
	document.getElementsByName("formerType")[0].value = '';
	document.getElementsByName("lastType")[0].value = '';
}